class LittlerRouter(object):
    """
    A router to control all database operations on models in the
    bugzilla application.
    """

    def db_for_read(self, model, **hints):
        """
        Attempts to read bugzilla models go to bugzilla DB.
        """
        if model._meta.app_label == 'littler':
            return 'littler'
        return None

    def db_for_write(self, model, **hints):
        """
        Attempts to write bugzilla models go to bugzilla DB.
        """
        if model._meta.app_label == 'littler':
            return 'littler'
        return None

    def allow_relation(self, obj1, obj2, **hints):
        """
        Allow relations if a model in the bugzilla app is involved.
        """
        if obj1._meta.app_label == 'littler' or \
                        obj2._meta.app_label == 'littler':
            return True
        return None

    def allow_migrate(self, db, model):
        """
        Make sure the bugzilla app only appears in the bugzilla database.
        """
        if db == 'littler':
            return model._meta.app_label == 'littler'
        elif model._meta.app_label == 'littler':
            return False

    def allow_syncdb(self, db, model):
        if db == 'littler' or model._meta.app_label == "littler":
            return False  # we're not using syncdb on our bugzilla database
        else:  # but all other models/databases are fine
            return True
        return None
